package thread;

public class SynDemo3 {
    public static void main(String[] args) {
        Boo b1 = new Boo();
        Boo b2 = new Boo();
        Thread t1 = new Thread("徐志杰"){
            public void run(){
              Boo.doSome();
                b1.doSome();
            }
        };
        Thread t2 = new Thread("孙双良"){
            public void run(){
             Boo.doSome();
                b2.doSome();
            }
        };
        t1.start();
        t2.start();
        };

    }

class Boo {
    public static void doSome(){
        synchronized (Boo.class) {
            Thread t = Thread.currentThread();
            System.out.println(t.getName() + "正在运行");
            try {
                Thread.sleep(4000);
            } catch (InterruptedException e) {

            }
            System.out.println(t.getName() + "运行结束");
        }
    }
}